package com.hanyxx.thread.lambda;

/**
 * 标准方式(面向对象)创建线程
 * @author layman
 */
public class Demo01  {
    public static void main(String[] args) {
        //标准方式创建线程
        Demo01Runnable run = new Demo01Runnable();
        Thread t = new Thread(run);
        t.start();

        //匿名内部类方式创建线程
        Runnable r = new Runnable(){
            @Override
            public void run() {
                System.out.println(Thread.currentThread().getName()+"--线程任务开启");
            }
        };
        new Thread(new Runnable(){
            @Override
            public void run() {
                System.out.println(Thread.currentThread().getName()+"--线程任务开启");
            }
        }).start();
    }
}
class Demo01Runnable implements Runnable{

    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName()+"--线程任务开启");
    }
}
